﻿using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using MyRoguelike.Game.Objects;
using MyRoguelike.Tools;
using Microsoft.Xna.Framework.Input;

namespace MyRoguelike.GUI
{
    class GUIInventory
    {
        private GOPlayer _player;

        // Is open?
        public bool IsOpen { get; protected set; }

        public GUIInventory(GOPlayer player)
        {
            _player = player;
        }

        public void Update(GameTime gameTime)
        {
            if (InputManager.KeyboardClick(Keys.Tab))
            {
                if (IsOpen) Close();
                else Open();
            }
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            if (IsOpen)
            {
                Viewport viewport = ResourceManager.Game.GraphicsDevice.Viewport;

                DrawPrimitives.FillRectangle(spriteBatch, new Rectangle(0, 0, 300, viewport.Height), Color.Black);
                DrawPrimitives.DrawLine(spriteBatch,
                                        new Vector2(300, 0),
                                        new Vector2(300, viewport.Height), Color.White);

                //Todo: draw items names
            }
        }

        /// <summary>
        /// Open inventory
        /// </summary>
        public void Open()
        {
            IsOpen = true;
        }

        /// <summary>
        /// Close inventory
        /// </summary>
        public void Close()
        {
            IsOpen = false;
        }
    }
}
